import java.util.*;
import java.io.*;

public class test {
    public static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    // 蓝桥杯 松散子序列(⭐⭐)
    public static void main(String[] args) throws IOException {
        String s = " " + in.next();
        char[] arr = s.toCharArray();
        int n = arr.length - 1;
        //dp[i][0] 代表此时不为松散子序列
        //dp[i][1] 代表此时为松散子序列
        int[][] dp = new int[n + 1][2];
        dp[1][0] = 0;
        dp[1][1] = arr[1] - 'a' + 1;
        for(int i = 2;i <= n;i++){
            //当前字母价值
            int price = arr[i] - 'a' + 1;
            dp[i][0] = Math.max(dp[i-1][0],dp[i-1][1]);
            dp[i][1] = Math.max(dp[i-1][0],dp[i-1][1] - (arr[i-1] - 'a' + 1)) + price;
            //System.out.println(i + ": " + dp[i][0] + " " + dp[i][1]);
        }
        System.out.println(Math.max(dp[n][0],dp[n][1]));
    }
    // 蓝桥杯 数组分割(⭐⭐)
    public static void main1(String[] args) throws IOException{
        int t = in.nextInt();
        while(t-- > 0) {
            int n = in.nextInt();
            int[] nums = new int[n];
            int sum = 0;
            for(int i = 0;i < n;i++) {
                nums[i] = in.nextInt();
                sum += nums[i];
            }
            //sum为奇数,不存在均分为偶数组合的情况
            if(sum % 2 != 0) {
                System.out.println(0);
                continue;
            }
            //如: 0 1 2 3 4 5 6 7 8 9 10 11
            //只要找出一个和为偶数的子序列,另一个补集的和自然也就为偶数
            //所以就转变成了"找和为偶数的子序列有多少"
            //dp代表前i个元素中,对2取余为0或1的子序列个数

            //1.创建dp表
            long[][] dp = new long[n + 5][2];
            //2.初始化
            dp[0][0] = 1;
            dp[0][1] = 0;
            // 1 2 3 4 5
            //3.填表
            for(int i = 1;i <= n;i++) {
                //如果i为偶数
                if(nums[i - 1] % 2 == 0) {
                    //选
                    dp[i][0] = (dp[i-1][0] * 2) % 1000000007;
                    dp[i][1] = (dp[i-1][1] * 2) % 1000000007;
                }else {
                    dp[i][0] = (dp[i-1][1] + dp[i-1][0]) % 1000000007;
                    dp[i][1] = (dp[i-1][0] + dp[i-1][1]) % 1000000007;
                }
            }
            //4.返回值
            System.out.println(dp[n][0]);
        }
    }
    // 蓝桥杯 大学里的树木要维护(⭐)
    public static void main2(String[] args) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        int[] arr = new int[n + 1];
        int[] sum = new int[n + 1];
        for(int i = 1;i <= n;i++){
            arr[i] = in.nextInt();
            sum[i] = sum[i - 1] + arr[i];
        }
        while(m-- > 0){
            int l = in.nextInt();
            int r = in.nextInt();
            System.out.println(sum[r] - sum[l - 1]);
        }
    }
    // 蓝桥杯 N皇后问题(⭐⭐⭐)
    public static int[] b1;// b = y - x;(可能是负的)
    public static int[] b2;// b = y + x;
    public static int[] b3;// b = y(这一列是否有)
    public static int sum;//存储所有合法情况
    public static int INF = 20;
    public static int n;
    public static void main3(String[] args) throws IOException {
        n = in.nextInt();
        b1 = new int[50];b2 = new int[50];b3 = new int[50];
        dfs(1,1,0);
        System.out.println(sum);
    }
    //皇后坐标,当前放置皇后个数
    public static void dfs(int x,int y,int num){
        if(num == n){
            sum++;
            return;
        }
        if(x > n || y > n){
            return;
        }
        //对该列中的每一个x坐标都尝试放皇后
        for(int i = 1;i <= n;i++){
            int bx = y - i + INF;
            int by = y + i;
            //有一个冲突,就会导致放置失败
            if(b1[bx] != 0 || b2[by] != 0 || b3[i] != 0){
                continue;
            }
            //没有冲突,则记录
            b1[bx] = 1;b2[by] = 1;b3[i] = 1;
            //前往下一列进行比较
            dfs(i,y + 1,num + 1);
            //回复现场
            b1[bx] = 0;b2[by] = 0;b3[i] = 0;
        }
    }
}
//10
//0000111111
class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}